<template>
  <div class="header">
    <div class="main">
      <router-link to="/" class="logo">
        <img src="../assets/logo.svg" />
      </router-link>
      <div class="nav" v-for="(item, index) in nav" :key="index">
        <router-link :to="item.url" :class="[index == msg ? 'active' : '']">
          {{ item.title }}
        </router-link>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "GlobalHeader",
  props: {
    msg: String
  },
  data: function() {
    return {
      nav: [
        {
          title: "居品哲学",
          url: "/philosophy"
        },
        {
          title: "成品家具",
          url: "/finish"
        },
        {
          title: "软装系统",
          url: "/system"
        },
        {
          title: "全屋定制",
          url: "/"
        }
      ]
    };
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.header {
  width: 100%;
  height: auto;
  display: block;
  float: left;
  .main {
    border-bottom: 1px solid #000000;
    .logo {
      width: 200px;
      height: 60px;
      display: block;
      float: left;
      margin: 25px 0 20px 0;
      img {
        width: 200px;
        height: 60px;
        display: block;
        float: left;
      }
    }
    .nav {
      width: auto;
      height: auto;
      display: block;
      float: right;
      margin: 45px 0 0 0;
      a {
        font-size: 25px;
        width: auto;
        height: auto;
        display: block;
        float: right;
        cursor: pointer;
        color: #9fa0a0;
        margin: 0px 0 0 50px;
      }
      a.active,
      a:hover {
        color: #000000;
      }
    }
  }
}
</style>
